﻿@using TSites.Administrator.Extensions
@using TSites.Common.Const;
@model TSites.Administrator.Models.UserEditViewModel
@{
    ViewBag.Title = "Edit User";
}
<link href="@Url.Stylesheet("jquery.ui.all.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Script("jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Script("jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Script("jquery.ui.core.min.js")" type="text/javascript"></script>
<script src="@Url.Script("jquery.ui.datepicker.min.js")" type="text/javascript"></script>
<script src="@Url.Script("jquery.ui.datepicker-vi.js")" type="text/javascript"></script>

@if (Model != null)
{
	using (@Html.BeginForm("Edit", "UserManagement", FormMethod.Post))
	{
		@Html.ValidationSummary(true, "There was error while process edit user")
		@Html.HiddenFor(m => m.UserId)
		@Html.ValidationMessageFor(m => m.UserId)
		<table>
			<tr>
				<td>@Html.LabelFor(m => m.Username)</td>
				<td>
					@Html.TextBoxFor(m => m.Username)
					@Html.ValidationMessageFor(m => m.Username)
				</td>
			</tr>
			<tr>
				<td>@Html.LabelFor(m => m.Password)</td>
				<td>
					@Html.TextBox("NewPassword")
					@Html.ValidationMessageFor(m => m.Password)
				</td>
			</tr>
			<tr>
				<td>@Html.LabelFor(m => m.Email)</td>
				<td>
					@Html.TextBoxFor(m => m.Email)
					@Html.ValidationMessageFor(m => m.Email)
				</td>
			</tr>
			<tr>
				<td>@Html.LabelFor(m => m.DateOfBirth)</td>
				<td>
					@Html.DatePicker("DateOfBirth", Model.DateOfBirth.ToString(StringConst.DATETIME_FORMAT_VN),
						new
						{
							dateFormat = "dd/mm/yy",
							displayMonYear = true,
							yearRange = "-100:-3",
							regional = "vi"
						})
				</td>
			</tr>
			<tr>
				<td>@Html.LabelFor(m => m.Sex)</td>
				<td>
					@Html.RadioButton("rdoMale", "M", Model.Sex == 'M') Male
					@Html.RadioButton("rdoMale", "F", Model.Sex == 'F') Female
				</td>
			</tr>
			<tr>
				<td>@Html.LabelFor(m => m.Address)</td>
				<td>@Html.TextBoxFor(m => m.Address)</td>
			</tr>
			<tr>
				<td>@Html.LabelFor(m => m.PhoneNumber)</td>
				<td>@Html.TextBoxFor(m => m.PhoneNumber)</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<input type="submit" value="Edit" />
					@Html.ActionLink("Back to Search", "Index", "UserManagement")
				</td>
			</tr>
		</table>
	}
}